﻿@{
    ViewData["Title"] = "知问";
}
@model Mango.Web.ViewModels.PostsViewModel

@Html.PartialAsync("~/Views/Posts/TopNavgation.cshtml", Model.PostsChannelData).Result
<div class="my-3 p-3 bg-white rounded box-shadow">
        @foreach (var item in Model.ListData)
        {
            <div class="media pt-2 border-bottom border-gray ">
                <img src="@(item.HeadUrl)" alt="" class="mr-2 rounded" style="width:40px;height:40px;">
                <div class="media-body pb-3 mb-0 small lh-125">
                    <a  href="/posts/read/@item.PostsId" target="_blank" style="color:black;"><h6 class="d-block">@item.Title</h6></a>
                    <span><img src="~/style/bootstrap/dist/icons/clock.svg" style="width:12px;height:12px;" title="发布时间" />：@item.PostDate.ToString("yyyy-MM-dd HH:mm:ss")</span>

                    <span style="margin-left:10px;"><img src="~/style/bootstrap/dist/icons/eye.svg" style="width:12px;height:12px;" title="浏览次数" />：@item.ReadCount</span>

                    <span style="margin-left:10px;"><img src="~/style/bootstrap/dist/icons/comment.svg" style="width:12px;height:12px;" title="回复数" />：@item.AnswerCount</span>
                </div>
            </div>
        }
</div>
<div class="row">
    <div class="col-lg-12">
        <nav aria-label="">
            <ul class="pagination">
                @if (Model.TotalCount > 0)
                {
                    @Html.Pager(ViewContext.HttpContext.Request, 10, Model.TotalCount)
                }
                else
                {
                    <li>没有数据记录...</li>
                }
            </ul>
        </nav>
    </div>
</div>
@section Scripts{
    <script type="text/javascript">
        $(window).ready(function () {
            var id = '@Html.Raw(Html.ViewContext.RouteData.Values["id"]!=null? Html.ViewContext.RouteData.Values["id"].ToString() : "0")';
            $("#channelList").find("a").each(function (i) {
                if (id == $(this).attr('data-id')) {
                    $(this).addClass("active");
                }
            });
        });
    </script>
}
